<div class="span12">
	<h2>Cat&eacute;gories - Option</h2>

	<div id="ajax-response">
	<?php 
	if(isset($_SESSION['notification'])){
		echo implode(' <br/> ',$_SESSION['notification']);
		unset($_SESSION['notification']);
	}
	?>
	</div>
	
	<form class="form-search pull-right" method="post" accept-charset="utf-8" action="">
	  <div class="input-append">
	  	<input name="search_option" value="<?php echo isset($_POST['search_option'])?$_POST['search_option']:''?>"  type="text" class="search-query"/>
		<button class="btn" type="submit"><i class="icon-search"></i></button>
	</div>
	</form>
</div>
<div class="row-fluid">

<div class="span3">
<form class="form-search" action="" method="post" id="addtag">
<legend>Créer Option</legend>
<div class="control-group">
	<label  class="control-label" for="tag-name">Nom de l'option:</label>
	
		<input type="text" aria-required="true" size="40" value="" id="tag-name" name="name">
	
</div>
<div class="control-group">
	<label  class="control-label"  for="type">Type :</label>
	<select class="postform" id="type" name="type">
		<option value="input">Champs &agrave; saisir</option>
		<option value="select">Liste d&eacute;roulant</option>
	</select>
	<small>Champs à saisir : Ce type va creer un champ de texte ou l'utilisateur rentre une valeur.<br />
			  Liste déroulante : 
			Ce type creer un menu déroulant avec les différentes valeur.</small>
	
</div>

<div class="control-group">
	<label  class="control-label" for="type">Parent :</label>

	<select class="postform" name="parent">
		<option value="0">aucune</option>
		<?php echo $optionParent?>
	</select>
</div>
<div class="control-group">
	<label  class="control-label" for="tag-value">Valeur par defaut :</label>
	<div class="controls">
		<textarea rows="5" id="tag-value" name="value"></textarea>
	</div>
</div>

<div class="control-group">
	<label  class="control-label" for="tag-unit">Unité :</label>
	
	<input type="text" aria-required="true" size="40" value="" id="tag-unit" name="unit">
	<small>Exemple : pièce,m²,etc....</small>
</div>

<p class="controls">
	<input type="submit" value="Ajouter Nouvelle Option" class="btn " id="submit" name="Add_Options">
</p>
</form>
</div>


<div class="span9">

<form class="form-horizontal"  id="posts-filter" method="post" accept-charset="utf-8" action="">
<table  class="table table-striped">
	<thead>
		<tr>
			<th class="manage-column column-name_type sortable desc" id="name_type" scope="col">
				<a href="#name_type"><span>Nom Option</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-type sortable desc" id="type" scope="col">
				<a href="#type"><span>Type</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-value sortable desc" id="value" scope="col">
				<a href="#value"><span>Valeur par default</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-unity sortable desc" id="unity" scope="col">
				<a href="#value"><span>Unité</span><span class="sorting-indicator"></span></a>
			</th>
		</tr>
	</thead>

	<tfoot>
		<tr>
			<th class="manage-column column-name_type sortable desc" id="name_type" scope="col">
				<a href="#name_type"><span>Nom Option</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-type sortable desc" id="type" scope="col">
				<a href="#type"><span>Type</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-value sortable desc" id="value" scope="col">
				<a href="#value"><span>Valeur par default</span><span class="sorting-indicator"></span></a>
			</th>
			<th class="manage-column column-unity sortable desc" id="unity" scope="col">
				<a href="#value"><span>Unité</span><span class="sorting-indicator"></span></a>
			</th>
		</tr>
	</tfoot>

	<tbody data-wp-lists="list:tag" id="the-list">
	<?php 
	foreach($tableOptionBody as $row){
	
		$id=$row->id_type;
		$valueDefault=$row->value;
		if($row->type=='select'){
			
			$valueDefault='
					<select>';
			if(is_array($expValue=explode(',',$row->value)))
				foreach ($expValue as $val)$valueDefault.="<option>$val</option>";
			$valueDefault.="</select>
				";
		}
			echo "
		<tr id='option-$id'>
			<td  class='show-action' >
			<strong class='row-title'id='option$id'>{$row->name}</strong>
				<div class='row-actions'>
					<span class='inline editinlineOption'> Edition rapide  | </span>
					<span class='delete'><a href='setting/option/delete/$id' class='delete-tag'>Supprimer</a> </span>
				</div>
				<div id='inline_$id' class='hide'>
					<div class='name'>{$row->name}</div>
					<div class='type'>{$row->type}</div>
					<div class='value'>{$row->value}</div>
				</div>
			</td>
			<td class='slug column-slug'>{$row->type}</td>
			<td>{$valueDefault}</td>
			<td>{$row->unit}</td>
		</tr>";
		}
	?>
	</tbody>
</table>

</form>

<p><strong>Note:</strong><br>
  Supprimer une cat&eacute;gorie ne supprime pas les m&eacute;ssages pr&eacute;sent dans celle ci.
Cependant les messages qui ont &eacute;t&eacute; affect&eacute;s sont mis dans la cat&eacute;gorie <strong>Non class&eacute;</strong>.</p>
<p>Les cat&eacute;gories selectionn&eacute;es peuvent etre converti en utilisant des balises pour <a href="import.php">marquer la cat&eacute;gorie</a>.</p>
</div>


</div>








	<table style="display: none">
	<tbody>
		<tr style="display: none" class="inline-edit-row" id="inlineedit">
		<td colspan="5">

		<form action="" method="post" class="form-horizontal" >
		
			<div class="inline-edit-col">
				<h4>Edition Rapide</h4>

				<div class="control-group">
					<label class="control-label">Nom</label>
					<div class="controls">
						<input id="tag-name" type="text" value="" class="input-xxlarge" name="name" />
					</div>
				</label>
				</div>
				<div class="control-group">
					<label class="control-label">Type</label>
					<div class="controls">
						<select class="postform" name="type">
							<option value="input">Champs à saisir</option>
							<option value="select">Liste déroulant</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">parent</label>
					<div class="controls">
					<select class="postform" name="parent">
						<option value="0">aucune</option>
						<?php echo $optionParent?>
					</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Value</label>
					<div class="controls">					
					<textarea class="row-fluid" rows="1" name="value"></textarea>
					</div>
				
				</div>
				<div class="control-group">
					<label class="control-label">Unité</label>
					<div class="controls">
					<input id="tag-unit" type="text" value="" class="ptitle" name="unit" />
					</div>
				</div>
			</div>
			
			<p class="controls">
				<button class="btn" title="Annuler" onclick="$(this).parents('.inline-edit-row').hide()">Annuler</button>
				<button class="btn" name="Update_Options"  value="Update_Category" type="submit" accesskey="s">Mise à jour l'Option</button>
				<input type="hidden" value="" name="id">
			</p>
		</form>
		</td>
		</tr>
		</tbody>
	</table>
	
		